<?php

namespace Fun\Jobeet\Model\Job;

/**
 * Job
 */
class Job
{
  /**
   * @var integer
   */
  private $id;

  /**
   * @var string
   */
  private $type;

  /**
   * @var string
   */
  private $company;

  /**
   * @var string
   */
  private $logo;

  /**
   * @var string
   */
  private $url;

  /**
   * @var string
   */
  private $position;

  /**
   * @var string
   */
  private $location;

  /**
   * @var string
   */
  private $description;

  /**
   * @var string
   */
  private $how_to_apply;

  /**
   * @var string
   */
  private $token;

  /**
   * @var boolean
   */
  private $is_public;

  /**
   * @var boolean
   */
  private $is_activated;

  /**
   * @var string
   */
  private $email;

  /**
   * @var \DateTime
   */
  private $expires_at;

  /**
   * @var \DateTime
   */
  private $created_at;

  /**
   * @var \DateTime
   */
  private $updated_at;

  /**
   * @var \Fun\Jobeet\Model\Category\Category
   */
  private $category;


  /**
   * Get id
   *
   * @return integer
   */
  public function getId()
  {
    return $this->id;
  }

  /**
   * Set type
   *
   * @param string $type
   *
   * @return Job
   */
  public function setType($type)
  {
    $this->type = $type;

    return $this;
  }

  /**
   * Get type
   *
   * @return string
   */
  public function getType()
  {
    return $this->type;
  }

  /**
   * Set company
   *
   * @param string $company
   *
   * @return Job
   */
  public function setCompany($company)
  {
    $this->company = $company;

    return $this;
  }

  /**
   * Get company
   *
   * @return string
   */
  public function getCompany()
  {
    return $this->company;
  }

  /**
   * Set logo
   *
   * @param string $logo
   *
   * @return Job
   */
  public function setLogo($logo)
  {
    $this->logo = $logo;

    return $this;
  }

  /**
   * Get logo
   *
   * @return string
   */
  public function getLogo()
  {
    return $this->logo;
  }

  /**
   * Set url
   *
   * @param string $url
   *
   * @return Job
   */
  public function setUrl($url)
  {
    $this->url = $url;

    return $this;
  }

  /**
   * Get url
   *
   * @return string
   */
  public function getUrl()
  {
    return $this->url;
  }

  /**
   * Set position
   *
   * @param string $position
   *
   * @return Job
   */
  public function setPosition($position)
  {
    $this->position = $position;

    return $this;
  }

  /**
   * Get position
   *
   * @return string
   */
  public function getPosition()
  {
    return $this->position;
  }

  /**
   * Set location
   *
   * @param string $location
   *
   * @return Job
   */
  public function setLocation($location)
  {
    $this->location = $location;

    return $this;
  }

  /**
   * Get location
   *
   * @return string
   */
  public function getLocation()
  {
    return $this->location;
  }

  /**
   * Set description
   *
   * @param string $description
   *
   * @return Job
   */
  public function setDescription($description)
  {
    $this->description = $description;

    return $this;
  }

  /**
   * Get description
   *
   * @return string
   */
  public function getDescription()
  {
    return $this->description;
  }

  /**
   * Set howToApply
   *
   * @param string $howToApply
   *
   * @return Job
   */
  public function setHowToApply($howToApply)
  {
    $this->how_to_apply = $howToApply;

    return $this;
  }

  /**
   * Get howToApply
   *
   * @return string
   */
  public function getHowToApply()
  {
    return $this->how_to_apply;
  }

  /**
   * Set token
   *
   * @param string $token
   *
   * @return Job
   */
  public function setToken($token)
  {
    $this->token = $token;

    return $this;
  }

  /**
   * Get token
   *
   * @return string
   */
  public function getToken()
  {
    return $this->token;
  }

  /**
   * Set isPublic
   *
   * @param boolean $isPublic
   *
   * @return Job
   */
  public function setIsPublic($isPublic)
  {
    $this->is_public = $isPublic;

    return $this;
  }

  /**
   * Get isPublic
   *
   * @return boolean
   */
  public function getIsPublic()
  {
    return $this->is_public;
  }

  /**
   * Set isActivated
   *
   * @param boolean $isActivated
   *
   * @return Job
   */
  public function setIsActivated($isActivated)
  {
    $this->is_activated = $isActivated;

    return $this;
  }

  /**
   * Get isActivated
   *
   * @return boolean
   */
  public function getIsActivated()
  {
    return $this->is_activated;
  }

  /**
   * Set email
   *
   * @param string $email
   *
   * @return Job
   */
  public function setEmail($email)
  {
    $this->email = $email;

    return $this;
  }

  /**
   * Get email
   *
   * @return string
   */
  public function getEmail()
  {
    return $this->email;
  }

  /**
   * Set expiresAt
   *
   * @param \DateTime $expiresAt
   *
   * @return Job
   */
  public function setExpiresAt($expiresAt)
  {
    $this->expires_at = $expiresAt;

    return $this;
  }

  /**
   * Get expiresAt
   *
   * @return \DateTime
   */
  public function getExpiresAt()
  {
    return $this->expires_at;
  }

  /**
   * Set createdAt
   *
   * @param \DateTime $createdAt
   *
   * @return Job
   */
  public function setCreatedAt($createdAt)
  {
    $this->created_at = $createdAt;

    return $this;
  }

  /**
   * Get createdAt
   *
   * @return \DateTime
   */
  public function getCreatedAt()
  {
    return $this->created_at;
  }

  /**
   * Set updatedAt
   *
   * @param \DateTime $updatedAt
   *
   * @return Job
   */
  public function setUpdatedAt($updatedAt)
  {
    $this->updated_at = $updatedAt;

    return $this;
  }

  /**
   * Get updatedAt
   *
   * @return \DateTime
   */
  public function getUpdatedAt()
  {
    return $this->updated_at;
  }

  /**
   * Set category
   *
   * @param \Fun\Jobeet\Model\Category\Category $category
   *
   * @return Job
   */
  public function setCategory(\Fun\Jobeet\Model\Category\Category $category = null)
  {
    $this->category = $category;

    return $this;
  }

  /**
   * Get category
   *
   * @return \Fun\Jobeet\Model\Category\Category
   */
  public function getCategory()
  {
    return $this->category;
  }

  public function setCreatedAtValue() {
    if (!$this->getCreatedAt()) $this->created_at = new \DateTime;
  }

  public function setUpdatedAtValue() {
    $this->updated_at = new \DateTime;
  }

  public function setExpiresAtValue() {
    if (!$this->getExpiresAt()) {
      $n = $this->getCreatedAt() ? $this->getCreatedAt()->format('U') : time();
      $this->expires_at = new \DateTime(date('Y-m-d H:i:s', $n + 86400 * 30));
    }
  }

}
